<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="content">设置</block>
		</cu-custom>
		<view class="setitem" @click="tologin">
			<text>修改登录密码</text>
			<image class="rightLogo" src="../../static/image/icon/right.png"></image> 
		</view>
		<view class="setitem" @click="topayWord">
			<text>修改支付密码</text>
			<image class="rightLogo" src="../../static/image/icon/right.png"></image>
		</view> 
		<view class="setitem" @click="todownload">
			<text>下载APP</text>
			<image class="rightLogo" src="../../static/image/icon/right.png"></image>
		</view>
		<!-- <view class="setitem" @click="toabout">
			<view style="display: flex;align-items: center;">
				<text>关于APP</text>
				<text class="newText" v-if="newapp" style="font-size: 22upx;">NEW</text>
			</view>
			<image src="../../static/images/a-right.png"></image>
		</view> -->
		<!-- <view class="setitem" @click="toggleLang">
			<text>{{$t('message.language_switching')}}</text>
			<image src="../../static/images/a-right.png"></image>
		</view>
		<view class="subBtn" @click="logout">{{$t('message.logout')}}</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad(){
			
		},
		methods: {
			tologin(){
				uni.navigateTo({
					url:'/pages/login/resetPassword?type=1&login=1'
				})
			},
			topayWord(){
				uni.navigateTo({
					url:'/pages/login/resetPassword?type=2&login=1'
				})
			},
			toabout(){
				uni.navigateTo({
					url:'/pages/my/aboutapp'
				})
			},
			todownload(){
				uni.navigateTo({
					url:'/pages/set/download'
				})
			},
			logout() {
				this.$showM('确定要退出当前帐号吗',true,res=>{
					if(res){
						this.$session.logout()
					}
				})
			},
			relogin(item){
				if(item.id == this.cid){
					return
				}
				var data = {
					org_id:item.id
				}
				this.$post(this.$Config.serverPath + '/tokerapp/org/change-org', data).then(res => {
					const data = res.data;
					this.$session.token =  data.app_token;
					this.$session.afterLogin({
					    token: data.app_token,
					    member_avatar: data.headimgurl,
					    member_name: data.nickname,
						store_avatar:item.logo,
						store_name:item.name,
						store_id:item.id,
						mobile:data.mobile
					});
					uni.reLaunch({
						url:'/pages/customer/index'
					})
				});
			},
			toggleLang(lang) {
				if(uni.getStorageSync('lang') == 'en'){
					var arr = ['Chinese', 'English']
				}else{
					var arr = ['中文', '英文']
				}
				var that = this
				uni.showActionSheet({
				    itemList: arr,
				    success: function (res) {
						if(res.tapIndex == 0){
							uni.setStorageSync('lang','cn')
							that.$i18n.locale = 'cn';
						}else{
							uni.setStorageSync('lang','en')
							that.$i18n.locale = 'en';
						}
						setTimeout(()=>{
							uni.reLaunch({
								url:'/pages/wallet/wallet'
							})
						},20)
				    }
				});
				
			}
		}
	}
</script>
	
<style scoped lang="less">
	.setitem{
		color: #000;
		display: flex;
		align-items: center;
		padding: 25upx 20upx;
		justify-content: space-between;
		font-size: 30upx;
		border-top:1px solid #eee;
		background: #fff;
	}
	.setitem image{
		width: 18upx;
		height: 30upx;
		margin-left: 20upx;
	}
	.subBtn{
		margin-left: 75upx;
		margin-top: 200upx;
	}
</style>
